refactor(models): unify model configuration and standardize LLM client factory #283
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces several key improvements and refactorings across the backend and frontend, primarily focusing on unifying model configuration management, updating service routing, and refactoring how LLM (Large Language Model) clients are created and used. The changes standardize the model configuration table and ORM usage in both Java and Python, introduce a new LLM factory for consistent model client instantiation, and update proxy and routing logic for better service separation.
Key changes include:
Model Configuration Standardization
t_model_configtot_modelsin both Java (ModelConfig.java) and Python (models.py), and updated the corresponding ORM class names and references throughout the codebase. Added anis_deletedfield and switched boolean fields to useBooleantype instead ofIntegerfor clarity and consistency. [1] [2] [3] [4] [5]Modelsclass andget_model_by_idhelper, ensuring consistent model retrieval and property access. [1] [2] [3] [4] [5] [6] [7]LLM Client Factory Introduction
LLMFactorymodule (app/module/shared/llm/__init__.py) to centralize and standardize the creation of chat and embedding model clients, as well as related utilities. Updated generation and RAG services to use this factory for all LLM interactions, replacing previous ad-hoc client creation logic. [1] [2] [3] [4] [5] [6] [7]API Gateway and Frontend Proxy Routing
/api/models/**.RAG Service Dependency Injection
RAGService, simplifying endpoint logic and making it easier to manage dependencies. [1] [2]These changes collectively improve maintainability, consistency, and scalability of model management and service orchestration across the system.